import React, { Component } from 'react';
//引入组件 
import ChildParen from "./Child1的子组件"
// 引入js
import {glabalContext} from './common/js'
const {Consumer} = glabalContext
//书写页面
class TransferToChild1 extends Component{
    render(){
        return(
            <div className="TransferToChild1">
                <h1>子组件child1</h1>
                {/* 读取父组件的role数据*/}
                <ChildParen/>
                <Consumer>
                    {
                        value=>(
                            <div>
                                {value.email}
                                <button onClick={()=>value.updateRole('王五')}>修改role</button>
                            </div>
                        )
                    }
                </Consumer>
            </div>
        )
    }
}
export default TransferToChild1;